package com.i360day.invoker.codes.encoder;

import com.i360day.invoker.support.RemoteInvocationResult;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;
import java.io.OutputStream;
import java.lang.reflect.Type;

public interface Encoder {

    /**
     * Write the given RemoteInvocationResult to the given HTTP response.
     *
     * @param response current HTTP response
     * @param responseType  current HTTP responseType
     * @param result   the RemoteInvocationResult object
     * @throws IOException in case of I/O failure
     */
    void writeRemoteInvocationResult(HttpServletResponse response, Type responseType, RemoteInvocationResult result) throws IOException;

    /**
     * 写入
     * @param outputStream
     * @param responseType
     * @param result
     * @throws IOException
     */
    void writeRemoteInvocationResult(OutputStream outputStream, Type responseType, RemoteInvocationResult result) throws IOException;
}
